//
//  UILabel+Contenlable.m
//  kuangjia
//
//  Created by 张帅 on 15/10/2.
//  Copyright © 2015年 ZhangShuai. All rights reserved.
//

#import "UILabel+Contenlable.h"

@implementation UILabel (Contenlable)


-(instancetype)initWithTitle:(NSString *)title color:(UIColor *)color sizeFont:(CGFloat)font {
    
    UILabel *lable =[[UILabel alloc] init];
    
    lable.text = title;
    
    lable.textColor = color;
    
    lable.font = [UIFont systemFontOfSize:font];
    [lable sizeToFit];
    return lable;
}

-(instancetype)initWithTitle:(NSString *)title color:(UIColor *)color sizeFont:(CGFloat)font layoutWidth:(CGFloat)layoutWidth{
   
    
    UILabel *lable =[[UILabel alloc] init];
    
    lable.text = title;
    
    lable.textColor = color;
    
    lable.font = [UIFont systemFontOfSize:font];
    
    if (layoutWidth>0) {
        
        lable.preferredMaxLayoutWidth= layoutWidth;
        lable.numberOfLines=0;
    }
    

//    [lable sizeToFit];
    return lable;
}
@end
